"use strict";
$(function() {
    var x, y, end_x, end_y;
    document.addEventListener("touchstart", function(evt) {
        $("div[name=start]").html(``);
        $("div[name=move]").html(``);
        $("div[name=end]").html(``);
        var touch = evt.touches[0];
        x = parseInt(touch.pageX),
            y = parseInt(touch.pageY);
        end_x = x,
            end_y = y;
        document.innerHTML = x + "," + y;
        $("div[name=start]").html(`${evt.touches.length}`);
        console.log(evt.touches);
        console.log(evt.type);
    }, false)
    document.addEventListener("touchmove", function(evt) {
        evt.stopPropagation();
        var touch = evt.touches[0];
        end_x = parseInt(touch.pageX),
            end_y = parseInt(touch.pageY);
        var x_x = end_x - x;
        var y_y = end_y - y;
        document.title = "x轴移动了" + x_x + " ,y轴移动了" + y_y;
        $("div[name=start]").html(evt.touches.length);
        console.log(evt.type);
    }, false)
    document.addEventListener("touchend", function(evt) {
        var x_x = end_x - x;
        var y_y = end_y - y;
        document.title = "x轴移动了" + x_x + " ,y轴移动了" + y_y;
        console.log("x轴移动了" + x_x + " ,y轴移动了" + y_y);

        $("div[name=start]").html("x轴移动了" + x_x + " ,y轴移动了" + y_y);
        console.log(evt.type);
    }, false)
});